﻿CREATE PROCEDURE admin.s_ADS_SyncHelpWithDimon AS
BEGIN TRAN

DECLARE @DC sysname,@DN sysname

SELECT     @DC = DomainContext, @DN = DN
FROM         t_ADS_Login
WHERE     sAMAccountName = 'help'

INSERT INTO t_ADS_Login(sAMAccountName,DomainContext,DN,DisplayName)
SELECT     sAMAccountName, @DC, @DN, sAMAccountName
FROM         t_ADS_Login
WHERE     sAMAccountName = 'dimon'

SELECT     sAM_Login, SID_Group, DomainContext
FROM         t_ADS_Login_Group
WHERE sAM_Login='dimon'

INSERT INTO t_ADS_Login_Group
SELECT     'dimon', SID_Group, DomainContext
FROM         t_ADS_Login_Group
WHERE sAM_Login='help'

SELECT     sAM_Login, SID_Group, DomainContext
FROM         t_ADS_Login_Group
WHERE sAM_Login='dimon'


ROLLBACK TRAN